﻿namespace SailHero.Soft.FrameWork.DAO.Common
{
    using System.Configuration;
   
    /// <summary>
    /// Represets the composition configuration.
    /// </summary>
    public class DAOConfigurationSection : ConfigurationSection
    {
        #region Fields
        private const string SectionPath = "DAO/DAOConfig";
        private const string ConfigsElement = "MapingConfigs";
        #endregion

        #region Properties
        /// <summary>
        /// Gets the collection of configurations.
        /// </summary>
        [ConfigurationProperty(ConfigsElement, IsDefaultCollection = true)]
        public DAOConfigurationElementCollection MapingConfigs
        {
            get { return (DAOConfigurationElementCollection)this[ConfigsElement]; }
            set { this[ConfigsElement] = value; }
        }
        #endregion

        #region Methods
        /// <summary>
        /// Gets an instance of <see cref="DAOConfigurationSection" /> that represents the current configuration.
        /// </summary>
        /// <returns>An instance of <see cref="DAOConfigurationSection" />, or null.</returns>
        public static DAOConfigurationSection GetInstance()
        {
            return ConfigurationManager.GetSection(SectionPath) as DAOConfigurationSection;
        }
        #endregion
    }
}